package com.ikingtech.platform.service.system.menu.service;

import com.ikingtech.framework.sdk.user.api.UserMenuApi;
import com.ikingtech.framework.sdk.utils.Tools;
import com.ikingtech.platform.service.system.menu.entity.MenuDO;
import com.ikingtech.platform.service.system.menu.service.repository.MenuRepository;
import lombok.RequiredArgsConstructor;

import java.util.List;

/**
 * @author tie yan
 */
@RequiredArgsConstructor
public class UserMenuService implements UserMenuApi {

    private final MenuRepository repo;

    @Override
    public List<String> loadIdByCodes(List<String> codes, String tenantCode) {
        List<MenuDO> entities = this.repo.listByCodesAndTenantCode(codes, tenantCode);
        return Tools.Coll.convertList(entities, MenuDO::getId);
    }
}
